package com.lianxi.controller;


import com.lianxi.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

@Controller
@RequestMapping("/model")
public class ModelController {

    @GetMapping("/success")
    public String  callBack(MultipartFile file, Model model){
        model.addAttribute("test","test");
        User user = new User();
        user.setAge(12);
        user.setId(12);
        user.setName("齐浩");
        model.addAttribute("user",user);
        return "success";
    }

    @GetMapping("/success2")
    public String  callBack2(String arr){
        System.out.println(arr);
        return "success2";
    }

    @GetMapping("/success3")
    @ResponseBody
    public String  callBack3(User user){
        return "success3";
    }

    @GetMapping("/success4")
    public String  callBack4(){
        return "layertest";
    }

    @GetMapping("/layuitest2")
    public String  callBack5(){

        return "layuitest2";
    }
}
